package deep;

import java.io.*;

/**
 * @Author Fish Paradise
 * @Description
 * @Date 2019/1/21  11:07
 **/
public class DeepDaiMa implements Serializable {
    public String getDaima() {
        return daima;
    }

    public void setDaima(String daima) {
        this.daima = daima;
    }

    public String daima = "Hello World!";


    public DeepDaiMa deepClone() throws IOException, ClassNotFoundException {
        ByteArrayOutputStream bao = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(bao);
        oos.writeObject(this);

        ByteArrayInputStream bis = new ByteArrayInputStream(bao.toByteArray());
        ObjectInputStream ois = new ObjectInputStream(bis);

        return (DeepDaiMa) ois.readObject();
    }
}
